package com;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.util.Properties;

/**
 * Created by chenjun on 2017/10/11.
 */
public class ConnectionUtil {

    private  static DataSource dataSource;

    static {
        DruidDataSource dds  = new DruidDataSource();
        dds.setDriverClassName("org.mariadb.jdbc.Driver");
        dds.setUsername("root");
        dds.setPassword("");
        dds.setUrl("jdbc:mariadb://127.0.0.1:3306/demo?useUnicode=true&characterEncoding=UTF-8");
        dds.setInitialSize(5);
        dds.setMinIdle(1);
        dds.setMaxActive(10);
        dataSource = dds;

    }

    public static DataSource getDataSource(){
        return  dataSource;
    }
}
